package br.gov.dataprev.treinamento.ejb.modelo;


import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.Digits;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

@Entity
@Table(name="TELEFONES_CLIENTES")
@IdClass(TelefonePK.class)
public class Telefone implements Serializable {

	private static final long serialVersionUID = 1L;
	
	//JPA
	@Id
	@Column(name="NU_DDD", nullable=false, length=2)
	//VALIDATION
	@NotNull
	@Min(1)
	@Max(99)
	private Short ddd;
	
	//JPA
	@Id
	@Column(name="NU_TELEFONE", nullable=false)
	//VALIDATION
	@NotNull
	@Digits(integer=8, fraction=0)
	private Integer telefone;
	
	@ManyToOne
	@JoinColumn(name="ID_CLIENTE")
	//VALIDATION
	@NotNull
	private Cliente cliente;

	

	public Cliente getCliente() {
		return cliente;
	}


	public void setCliente(Cliente cliente) {
		this.cliente = cliente;
	}


	public Telefone() {
		super();
		// TODO Auto-generated constructor stub
	}


	public Short getDdd() {
		return ddd;
	}


	public void setDdd(Short ddd) {
		this.ddd = ddd;
	}


	public Integer getTelefone() {
		return telefone;
	}


	public void setTelefone(Integer telefone) {
		this.telefone = telefone;
	}

}
